Ext.namespace("Ext.pos_public");
Ext.apply(Ext.form.VTypes, {
    listCombobox: function(val, com) {
        var valu = com.getValue();
        if(valu=='') return false;
        if(com.getStore().find(com.valueField,valu)<0)return false;
        return true;
    },
    // vtype Text property: The error text to display when the validation function returns false
    timeText: '请在下拉框中选择'
});
//机型
Ext.pos_public.patternName_Combo=Ext.extend(Ext.form.ComboBox,{
        store:new Ext.data.SimpleStore({
            fields:["value","text"],
            data:[["MOBILE","移动"],["DIAL","拨号"],["NET","网络"],["BLUETOOTH","蓝牙"]]
        }),
        editable:false,
        //forceSelection:true,
        emptyText:"请选择",
        mode:"local",
        triggerAction:"all",
        valueField:"value",
        displayField:"text",
        readyOnly:true
});
Ext.reg('patternName_Combo',Ext.pos_public.patternName_Combo);

//共用业务类型
Ext.pos_public.businessType_Combo=Ext.extend(Ext.form.ComboBox,{
    store:new Ext.data.JsonStore({
        url:basepath+"/yft/posBusinessType/getPosBusinessTypeListForCom.html",
        root:'root',
        totalProperty:'totalProperty',
        baseParams:{limit: 6},
        fields:[
            {name: 'id'},
            {name:'name'},
            {name: 'desc'}
        ]
    }),
    typeAhead: false,
    loadingText: '请稍后,正在查询...',
    width: 240,
    vtype:'listCombobox',
    vtypeText:'请在下拉框中选择',
    validateOnBlur:true,
    emptyText:'请输入业务类型...',
//    pageSize: colNum2_h,
    hideTrigger:true,
    //resizable: true,
    listWidth:260,
    tpl: new Ext.XTemplate(
        '<table style="font-size:12px"><tr valign="middle" align="center"><td width="10px">NO</td><td width="110px">业务类型</td><td width="110px">描述</td></tr>',
        '<tpl for=".">',
        '<tr class="search-item" valign="middle" align="center"><td>{#}</td><td>{name}</td><td>{desc}</td></tr>',
        '</tpl>',
        '</table>'
    ),
    displayField:'name',
    valueField:'id',
    selectOnFocus :true,
    minChars :1,
    itemSelector: 'tr.search-item'
});
Ext.reg('businessType_Combo',Ext.pos_public.businessType_Combo);

//pos进货渠道
Ext.pos_public.supplyChannel_Combo=Ext.extend(Ext.form.ComboBox,{
    store:new Ext.data.JsonStore({
        url:basepath+"/yft/posSupplyChannel/getPosSupplyChannelListForCom.html",
        root:'root',
        totalProperty:'totalProperty',
        baseParams:{limit: 6},
        fields:[
            {name: 'id'},
            {name:'name'},
            {name: 'desc'}
        ]
    }),
    typeAhead: false,
    loadingText: '请稍后,正在查询...',
    vtype:'listCombobox',
    vtypeText:'请在下拉框中选择',
    emptyText:'请输入进货渠道...',
    width: 240,
//    pageSize: colNum2_h,
    hideTrigger:true,
    //resizable: true,
    listWidth:260,
    tpl: new Ext.XTemplate(
        '<table style="font-size:12px"><tr valign="middle" align="center"><td width="10px">NO</td><td width="110px">进货渠道</td><td width="110px">描述</td></tr>',
        '<tpl for=".">',
        '<tr class="search-item" valign="middle" align="center"><td>{#}</td><td>{name}</td><td>{desc}</td></tr>',
        '</tpl>',
        '</table>'
    ),
    displayField:'name',
    valueField:'id',
    selectOnFocus :true,
    minChars :1,
    itemSelector: 'tr.search-item'
});
Ext.reg('supplyChannel_Combo',Ext.pos_public.supplyChannel_Combo);

//pos机型表
Ext.pos_public.posModel_Combo=Ext.extend(Ext.form.ComboBox,{
    store:new Ext.data.JsonStore({
        url:basepath+"/yft/posModel/getPosModelListForCom.html",
        root:'root',
        totalProperty:'totalProperty',
        baseParams:{limit: 6},
        fields:[
            {name: 'id'},
            {name:'patterndesc'},
            {name:'pattern'},
            {name: 'channelName'},
            {name: 'modelName'}
        ]
    }),
    recordIndex: '',
    typeAhead: false,
    loadingText: '请稍后,正在查询...',
    vtype:'listCombobox',
    vtypeText:'请在下拉框中选择',
    emptyText:'请输入进货渠道...',
    width: 240,
//    pageSize: colNum2_h,
    hideTrigger:true,
    //resizable: true,
    listWidth:260,
    tpl: new Ext.XTemplate(
        '<table style="font-size:12px"><tr valign="middle" align="center"><td width="10px">NO</td><td width="110px">机型</td><td width="110px">进货渠道</td><td width="110px">型号</td></tr>',
        '<tpl for=".">',
        '<tr class="search-item" valign="middle" align="center"><td>{#}</td><td>{patterndesc}</td><td>{channelName}</td><td>{modelName}</td></tr>',
        '</tpl>',
        '</table>'
    ),
    displayField:'modelName',
    valueField:'id',
    selectOnFocus :true,
    minChars :1,
    itemSelector: 'tr.search-item'
});
Ext.reg('posModel_Combo',Ext.pos_public.posModel_Combo);
